package cn.scu.ne04jdemo.entitiy;

import cn.scu.ne04jdemo.util.SysCodeUtil;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@Builder
@AllArgsConstructor
@ContentRowHeight(20)
@HeadRowHeight(35)
@ColumnWidth(20)
@TableName(value = "t_use_right_change")
public class UseRightChangeEntity implements Serializable {
    @TableId(type = IdType.AUTO)
    @ExcelIgnore
    private Long id;
    @ExcelIgnore
    private String rightType;
    @TableField(exist = false)
    @ExcelProperty(value = "权属名", index = 0)
    private String rightTypeName;
    @ExcelProperty(value = "数据集名称", index = 1)
    private String dataName;
    @ExcelIgnore
    private String userId;
    @ExcelProperty(value = "当前权利人", index = 2)
    private String userName;
    @ExcelProperty(value = "开始时间", index = 3)
    private String startTime;
    @ExcelProperty(value = "结束时间", index = 4)
    private String endTime;
    @ExcelIgnore
    private String rightRange;
    @TableField(exist = false)
    @ExcelProperty(value = "申请权限", index = 5)
    private String rightRangeName;
    @ExcelIgnore
    private String useRange;
    @TableField(exist = false)
    @ExcelProperty(value = "使用范围", index = 6)
    private String useRangeName;
    @ExcelIgnore
    private LocalDateTime createDate;

    @ExcelIgnore
    private LocalDateTime updateDate;

    public String getRightTypeName(){
        return SysCodeUtil.SysCodeMap.get(this.rightType);
    }
    public String getRightRangeName(){
        return SysCodeUtil.SysCodeMap.get(this.rightRange);
    }
    public String getUseRangeName(){
        return SysCodeUtil.SysCodeMap.get(this.useRange);
    }
}
